/*************************************************************************
> File Name: 008.c
> Author: icebear
> Mail: 3322366195@qq.com
> Created Time: 2023-07-24 16:53:10
> Description: 有一个3×4的矩阵，要求输出其中值最大的元素的值，以及它的行号和列号。
************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char const *argv[])
{

    int arr[3][4];
    srand(time(NULL));
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 4; j++)
        {
            arr[i][j] = rand() % 100;
        }
    }
    printf("A random content of the matrix is generated\n");
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 4; j++)
        {
            printf("%3d ", arr[i][j]);
        }
        printf("\n");
    }
    int maxValue = arr[0][0], maxRow = 0, maxColumn = 0;
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 4; j++)
        {
            if (maxValue < arr[i][j])
            {
                maxValue = arr[i][j];
                maxRow = i;
                maxColumn = j;
            }
        }
    }
    printf("The random  matrix maxValue is %d,maxRow is %d,maxColumn is %d\n", maxValue, maxRow + 1, maxColumn + 1);
    return 0;
}
